package com.tvunetworks.center.user.service;

import com.tvunetworks.center.common.model.LoginUser;
import com.tvunetworks.center.common.model.SearchDeviceParam;
import com.tvunetworks.center.user.model.BookmarkDevice;
import com.tvunetworks.center.user.model.json.VoBookmark;
import com.tvunetworks.center.user.model.param.SearchBookmarkDeviceParam;
import com.tvunetworks.center.user.model.vo.SearchUserDeviceVo;

import java.util.List;
import java.util.Map;
/**
 * @program: tvucc-aggregator
 * @author lebronchen
 * @create: 2020-04-24 13:17
 **/
public interface BookmarkDeviceService {

    /**
     * 列出用户的设备，过滤
     * @param userId userId
     * @param param param
     * @return List
     */
    List<String> listUserPeerIdFilterByBookmarkAndCondition(String userId, SearchDeviceParam param);

    /**
     *  列出用户未分类的设备
     * @param userId userId
     * @param condition condition
     * @param types types
     * @return List
     */
    List<String> listUserUnClassifiedPeerIds(String userId, String condition, List<String> types);

    /**
     *
     *
     *  查询device的bookmark
     *
     *  {
     *      "peerId2":["bookmark1","bookmark2","bookmark3"],
     *      "peerId1":["bookmark1","bookmark2","bookmark3"]
     *  }
     *
     *  如果对结果有疑问请查看该方法对应的单元测试
     *
     * @param userId userId
     * @param peerIds peerIds
     *
     *
     *
     * @return Map
     */
    Map<String, List<String>> listUserDeviceBookmarks(String userId, List<String> peerIds);

    /**
     * 删除下面用户所有的BookmarkDevice
     * @param userIds userIds
     */
    void removeUserBookmarkDevice(List<String> userIds);

    /**
     *
     * @param bookmarkId bookmarkId
     */
    void removeBookmarkDevice(String bookmarkId);

    /**
     * 改动UserBookmark、BookmarkDevice同时 更新Memcache
     */
    void setBookmarkDeviceToMem();

    /**
     * 列出未和当前书签绑定的设备
     * @param param param
     * @return List
     */
    List<SearchUserDeviceVo> listUnbindDevice(SearchBookmarkDeviceParam param);

    /**
     * 列出和当前书签绑定的设备，区分类型和Condition
     * @param param param
     * @return List
     */
    List<SearchUserDeviceVo> listBindedDevice(SearchBookmarkDeviceParam param);

    /**
     *
     * @param userId userId
     * @param bookmarkId bookmarkId
     * @return List
     */
     List<SearchUserDeviceVo> listBindedDeviceForToken(String userId,String bookmarkId);

    /**
     * 列出所有和当前书签绑定的设备
     * @param bookmarkId bookmarkId
     * @param userId userId
     * @return List
     */
    List<SearchUserDeviceVo> listAllBindedDevice(String userId, String bookmarkId);

    /**
     *
     * @param bookmarkId bookmarkId
     * @param addPeerIds addPeerIds
     * @param removePeerIds removePeerIds
     */
    void correlateBookmarkDevice(String bookmarkId, String addPeerIds, String removePeerIds);

    /**
     *
     * @param bookmarkIds bookmarkIds
     * @param addPeerId addPeerId
     * @param removeBookmarkIds  removeBookmarkIds
     * @param bookmarkPid bookmarkPid
     * @param name name
     * @param userId userId
     */
    void correlateDeviceBookmark(String bookmarkIds, String addPeerId, String removeBookmarkIds,String bookmarkPid, String name,String userId);

    /**
     * 移动书签下的设备到另一个书签
     * @param fromBookmarkId fromBookmarkId
     * @param toBookmarkIds toBookmarkIds
     * @param peerIds peerIds
     */
    void moveBookmarkDevice(String fromBookmarkId, String toBookmarkIds, String peerIds);

    /**
     *
     * @param peerId peerId
     */
    void removeBookmarkDeviceByPeerId(String peerId);

    /**
     *
     * @param user user
     * @param bookmarkId bookmarkId
     * @param activeNum activeNum
     * @return List
     * @throws Exception 编译异常
     */
     List<VoBookmark> getAllChildBookmarkTreeWithDevice(LoginUser user, String bookmarkId, String activeNum) throws Exception;

    /**
     *
     * @param user user
     * @param bookmarkId bookmarkId
     * @param activeNum activeNum
     * @return List
     * @throws Exception 编译异常
     */
     List<VoBookmark> getBookmarkShareAllChildBookmarkTreeWithDevice(LoginUser user, String bookmarkId, String activeNum) throws Exception;

    /**
     *
     * @param oldPeerId oldPeerId
     * @param newPeerId newPeerId
     * @param taskId taskId
     * @return copyDevice
     */
    int copyDevice(String oldPeerId, String newPeerId, String taskId);

    /**
     *
     * @param userId userId
     * @param peerId peerId
     * @return List
     */
     List<BookmarkDevice> listUserDeviceBookmarksByPeerId(String userId, String peerId);
}
